/**
 * 造一辆车
 */
public class MakeNewCar {
    public static void main(String[] args) {
        Tire tire = new Tire(20,"red");
        Bottom bottom = new Bottom(tire);
        Framework framework = new Framework(bottom);
        Car car = new Car(framework);
        car.init();
    }

    /**
     * 车类
     */
    static class Car{
        private Framework framework;
        public Car(Framework framework){
            this.framework = framework;
        }
        public void init() {
            framework.init();
        }
    }

    /**
     * 车身类
     */
    static class Framework{
        private Bottom bottom;
        public Framework(Bottom bottom){
            this.bottom = bottom;
        }
        public void init() {
            bottom.init();
        }
    }

    /**
     * 地盘类
     */
    static class Bottom {
        private Tire tire;
        public Bottom(Tire tire) {
            this.tire = tire;
        }
        public void init() {
            tire.init();
        }
    }

    /**
     * 轮胎类
     */
    static class Tire{
        private String color;
        private int size ;
        public Tire(int size,String color){
            this.size = size;
            this.color = color;
        }
        public void init() {
            System.out.println("轮胎尺寸: " + size);
            System.out.println("轮胎的颜色: " + color);
        }
    }
}
